%% Robust Option Characteristics (Table 3)
% FM regressions (Specification 1)
clear betas b t_stat
format short
for i = 1:size(call_deltahedge_returns_rb,1)
    % INSERT Y and X VARIABLES HERE FOR DIFFERENT SPECIFICATIONS %%%%%%%%%%
    Y = call_deltahedge_returns_rb(i,:)'*100; % Change here for put option returns

    X = [Stock_PRisk(i,:)', Stock_Vol_Deviation_log(i,:)', Stock_VolSlope(i,:)'];
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    stats = regstats(Y,[X]);    warning off 
    betas(i,:) = (stats.beta)';
    adjr2(i,1) = stats.adjrsquare;
end
clear stats Y X i

for i = 1:size(betas,2)
   nw_stats = nwest(betas(:,i),ones(size(betas(:,i))),4);
   b(i,1) = nw_stats.beta;
   t_stat(i,1) = nw_stats.tstat;
end
m_adjr2 = mean(adjr2);
clear nw_stats i adjr2 betas


%% FM regressions (Specification 2)
clear betas b t_stat
format short
for i = 1:size(call_deltahedge_returns_rb,1)
    % INSERT Y and X VARIABLES HERE FOR DIFFERENT SPECIFICATIONS %%%%%%%%%%
    Y = call_deltahedge_returns_rb(i,:)'*100; % Change here for put option returns

    X = [Stock_PRisk(i,:)', Stock_Vol_Deviation_log(i,:)', Stock_VolSlope(i,:)', ...
         Stock_RNS(i,:)', Stock_RNK(i,:)', Stock_VolSpread(i,:)', Stock_VOV(i,:)', ...
         ];
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    stats = regstats(Y,[X]);    warning off 
    betas(i,:) = (stats.beta)';
    adjr2(i,1) = stats.adjrsquare;
end
clear stats Y X i

for i = 1:size(betas,2)
   nw_stats = nwest(betas(:,i),ones(size(betas(:,i))),4);
   b(i,1) = nw_stats.beta;
   t_stat(i,1) = nw_stats.tstat;
end
m_adjr2 = mean(adjr2);
clear nw_stats i adjr2 betas


%% FM regressions (Specification 3)
clear betas b t_stat
format short
for i = 1:size(call_deltahedge_returns_rb,1)
    % INSERT Y and X VARIABLES HERE FOR DIFFERENT SPECIFICATIONS %%%%%%%%%%
    Y = call_deltahedge_returns_rb(i,:)'*100; % Change here for put option returns

    X = [Stock_PRisk(i,:)', Stock_Vol_Deviation_log(i,:)', Stock_VolSlope(i,:)', ...
         Stock_RNS(i,:)', Stock_RNK(i,:)', Stock_VolSpread(i,:)', Stock_VOV(i,:)', ...
         call_bidask_spread(i,:)'];
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    stats = regstats(Y,[X]);    warning off 
    betas(i,:) = (stats.beta)';
    adjr2(i,1) = stats.adjrsquare;
end
clear stats Y X i

for i = 1:size(betas,2)
   nw_stats = nwest(betas(:,i),ones(size(betas(:,i))),4);
   b(i,1) = nw_stats.beta;
   t_stat(i,1) = nw_stats.tstat;
end
m_adjr2 = mean(adjr2);
clear nw_stats i adjr2 betas
